/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package imagemanip.structures;

import fr.univnantes.alma.arbres.Noeud;

/**
 *
 * @author clotilde
 */

class PereOcFils implements java.lang.Comparable{
    private Noeud pere;
    private int occurrences; // Nombre d'occurrences de ses fils (combien il a de fils présents dans l'image)

    public PereOcFils(Noeud noeud, int n) {
        this.pere = noeud;
        this.occurrences = n;
    }

    public int getOccurrences() {
        return occurrences;
    }

    public Noeud getPere() {
        return pere;
    }

    public void setOccurrences(int occurrences) {
        this.occurrences = occurrences;
    }

    public int compareTo(Object t) {
        int n1 = ((PereOcFils) t).getOccurrences();
        int n2 = this.getOccurrences();
        if (n1>n2) return -1;
        else if (n1 == n2) return 0;
             else return 1;
    }
 
    
    
}
